package org.bright.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.bright.entity.Employee;
import org.bright.mapper.EmployeeMapper;
import org.bright.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    public int insertInto(Employee employee) {
        return employeeMapper.insertInto(employee);
    }

    @Override
    public PageInfo<Employee> getPage(Integer pageNum) {
        PageHelper.startPage(pageNum,3);
        List<Employee> list = employeeMapper.getList();
        PageInfo<Employee> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
